package com.gp.study.mybatis.executor;

import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;

import com.gp.study.mybatis.handler.StateMentHandler;
import com.gp.study.mybatis.session.Configuration;

public class BaseExecutor implements Executor {
	
	private Configuration configuration;
	
	public BaseExecutor(Configuration configuration) {
		this.configuration = configuration;
	}

	@Override
	public <T> T query(String statement, Object[] parameter, Class<?> pojo) throws SQLException {
		StateMentHandler stmtHandler = configuration.newStateMentHandler();
		try{
			return (T)stmtHandler.query(statement,parameter,pojo);
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}

}
